<template>
  <div class="bottonbar">
    <button class="button"></button>
    <samp class="text">全选</samp>
    <div class="jiage">合计{{ totalprice }}</div>
    <div class="calculate">去计算{{ checklength }}</div>
  </div>
</template>

<script>
export default {
  name: "cartbottonbar",
  computed: {
    totalprice() {
      return (
        "￥" +
        this.$store.state.cartlist
          .filter((itme) => {
            return itme.checked;
          })
          .reduce((preValue, itme) => {
            return preValue + itme.price * itme.count;
          }, 0)
          .toFixed(2)
      );
    },
    checklength() {
      return this.$store.state.cartlist.filter((itme) => itme.checked).length;
    },
  },
};
</script>

<style scoped>
.bottonbar {
  height: 40px;
  position: relative;
  background-color: rgb(180, 171, 171);
  bottom: 123px;
}
.button {
  border-radius: 50%;
  border: 10px solid #aaa;
}
.text {
  position: relative;
  top: 7px;
  left: 3px;
  bottom: -3px;
}
.jiage,
.calculate {
  color: rgb(224, 60, 10);
  display: inline-block;
  position: relative;
  top: 7px;
  left: 60px;
  right: 10px;
  bottom: 20px;
}
.calculate {
  top: 7px;
  left: 125px;
  right: 10px;
  bottom: 20px;
}
</style>